import { Component, OnInit } from '@angular/core';
import { VulnerabilityProfileEntry } from '@common/types';
import { VulnerabilityProfileService } from '@routes/vulnerability-profile/vulnerability-profile.service';

@Component({
  selector: 'app-vulnerability-profile',
  templateUrl: './vulnerability-profile.component.html',
  styleUrls: ['./vulnerability-profile.component.scss'],
})
export class VulnerabilityProfileComponent implements OnInit {
  vulnerabilityProfiles!: {
    profiles: VulnerabilityProfileEntry[];
    domains: string[];
  };
  loaded = false;

  constructor(
    private vulnerabilityProfileService: VulnerabilityProfileService
  ) {}

  ngOnInit(): void {
    this.vulnerabilityProfileService
      .initVulnerabilityProfile()
      .subscribe(profiles => {
        this.vulnerabilityProfiles = profiles;
        this.loaded = true;
      });
  }
}
